
//防抖
export const throttle = function (fn: any,t: any){ //fn是函数,t是时间
    let delay = t || 300;//t或300
    let timer: string | number | NodeJS.Timeout | null | undefined = null
    return  () =>{
        if(timer){
            clearTimeout(timer);//清除超时，时间
        }
        timer = setTimeout(() => {
            fn.apply(this,arguments)
        }, delay);
    }
}